package com.earthea.application.common.entity;

import cn.hutool.http.HttpStatus;
import com.earthea.common.exception.IErrorCode;

/**
 * 公共错误码
 */
public enum HttpCodeEnum implements IErrorCode {
    /**
     * 200成功
     */
    SUCCESS(HttpStatus.HTTP_OK, "success"),
    /**
     * 500系统未知错误
     */
    FAIL(HttpStatus.HTTP_INTERNAL_ERROR, "fail"),
    /**
     * 401没权限
     */
    HTTP_UNAUTHORIZED(HttpStatus.HTTP_UNAUTHORIZED, "invalid token"),
    ;

    private final int code;

    private final String msg;

    HttpCodeEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public int getIntCode() {
        return code;
    }

    @Override
    public int getCode() {
        return code;
    }

    @Override
    public String getMsg() {
        return msg;
    }
}
